'use strict';

const findOrCreate = require('../lib/mongoose/plugin_findorcreate');

module.exports = mongoose => {
  const SpaceSchema = new mongoose.Schema({
    myid: { type: String, unique: true }, //
    name: { type: String },
    alias: { type: String },
    typeId: { type: Number },
    description: { type: String },
  });

  SpaceSchema.plugin(findOrCreate);

  return mongoose.model('Space', SpaceSchema);
};
